import requests
from config import url, headers_web

class ClassInformations:
    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_attendance_activities_for_class_informations(cls, url_path: str, params=None, headers=headers_web,paramspath=None):
        """
        @Summary:根据上课信息获取正在进行的考勤活动息
        @Description:互动课堂考勤活动使用
        :param url_path:/teachingApi/v1/classinformations/{id}/attendanceactivities
        :param params:validCode:验证码：id=?&signKey=123123(md5加密)
        :param headers:
        :param paramspath:id:上课信息id
        :return:{
                'creatorId':'', #创建人id
                'creatorName':'',#创建人姓名
                'dynamicCode':'',#动态验证码
                'id':''#考勤活动id
                }
        """
        url_path = url_path + "/teachingApi/v1/classinformations/{}/attendanceactivities".format(paramspath)
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def  get_answer_activities_for_class_informations(cls, url_path: str, params=None, headers=headers_web,paramspath=None):
        """
        @Summary:根据上课信息获取正在进行的答题活动息
        @Description:互动课堂考勤活动使用
        :param url_path:/teachingApi/v1/topicactivities/{courseInformationId}/answeractivities
        :param params:{
                        'userId':'',#用户Id
                        'validCode':''#courseInformationId=?&signKey=123123(md5加密)
                        }
        :param headers:
        :param paramspath:courseInformationId:上课信息id
        :return:{
                'answerId':'', #课堂答题活动id
                'answerStatus':'',#答题状态
                'whetherAnswer':''#是否有答案
                }
        """
        url_path = url_path + "/teachingApi/v1/topicactivities/{}/answeractivities".format(paramspath)
        r = requests.get(url=url_path, headers=headers, params=params)
        return r